package com.aimao.blog.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import org.springframework.web.util.HtmlUtils;

import java.io.Serializable;
import java.util.Date;

public class Article implements Serializable {
    private Integer id;

    private String title;

    private String mainimg;

    private String content;

    private Long readcount;

    @JSONField(format = "yyyy/MM/dd")
    private Date createtime;

    private Date updatetime;

    private Integer type;

    private Boolean top;

    private Integer rootsort;

    private String tag;

    private String sortName;

    public Article(Integer id, String title, String mainimg, String content, Long readcount, Date createtime, Date updatetime, Integer type, Boolean top, Integer rootsort, String tag, String sortName) {
        this.id = id;
        this.title = title;
        this.mainimg = mainimg;
        this.content = content;
        this.readcount = readcount;
        this.createtime = createtime;
        this.updatetime = updatetime;
        this.type = type;
        this.top = top;
        this.rootsort = rootsort;
        this.tag = tag;
        this.sortName = sortName;
    }

    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    public Article() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public String getMainimg() {
        return mainimg;
    }

    public void setMainimg(String mainimg) {
        this.mainimg = mainimg == null ? null : mainimg.trim();
    }

    public String getContent() {
        return HtmlUtils.htmlUnescape(content);
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Long getReadcount() {
        return readcount;
    }

    public void setReadcount(Long readcount) {
        this.readcount = readcount;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Date getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Date updatetime) {
        this.updatetime = updatetime;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Boolean getTop() {
        return top;
    }

    public void setTop(Boolean top) {
        this.top = top;
    }

    public Integer getRootsort() {
        return rootsort;
    }

    public void setRootsort(Integer rootsort) {
        this.rootsort = rootsort;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag == null ? null : tag.trim();
    }
}